3.50 \(\int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx\)

Optimal. Leaf size=39 \[ x \left (a^2-b^2\right )-\frac {2 a b \log (\cos (c+d x))}{d}+\frac {b^2 \tan (c+d x)}{d} \]

[Out]

(a^2-b^2)*x-2*a*b*ln(cos(d*x+c))/d+b^2*tan(d*x+c)/d

________________________________________________________________________________________

Rubi [A]  time = 0.06, antiderivative size = 39, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.107, Rules used = {3086, 3477, 3475} \[ x \left (a^2-b^2\right )-\frac {2 a b \log (\cos (c+d x))}{d}+\frac {b^2 \tan (c+d x)}{d} \]

Antiderivative was successfully verified.

[In]

Int[Sec[c + d*x]^2*(a*Cos[c + d*x] + b*Sin[c + d*x])^2,x]

[Out]

(a^2 - b^2)*x - (2*a*b*Log[Cos[c + d*x]])/d + (b^2*Tan[c + d*x])/d

Rule 3086

Int[cos[(c_.) + (d_.)*(x_)]^(m_)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_.), x_Symb
ol] :> Int[(a + b*Tan[c + d*x])^n, x] /; FreeQ[{a, b, c, d}, x] && EqQ[m + n, 0] && IntegerQ[n] && NeQ[a^2 + b
^2, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3477

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2)*x, x] + (Dist[2*a*b, Int[Tan[c + d
*x], x], x] + Simp[(b^2*Tan[c + d*x])/d, x]) /; FreeQ[{a, b, c, d}, x]

Rubi steps

\begin {align*} \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx &=\int (a+b \tan (c+d x))^2 \, dx\\ &=\left (a^2-b^2\right ) x+\frac {b^2 \tan (c+d x)}{d}+(2 a b) \int \tan (c+d x) \, dx\\ &=\left (a^2-b^2\right ) x-\frac {2 a b \log (\cos (c+d x))}{d}+\frac {b^2 \tan (c+d x)}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C]  time = 0.14, size = 69, normalized size = 1.77 \[ \frac {2 b^2 \tan (c+d x)-i \left ((a+i b)^2 \log (-\tan (c+d x)+i)-(a-i b)^2 \log (\tan (c+d x)+i)\right )}{2 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Sec[c + d*x]^2*(a*Cos[c + d*x] + b*Sin[c + d*x])^2,x]

[Out]

((-I)*((a + I*b)^2*Log[I - Tan[c + d*x]] - (a - I*b)^2*Log[I + Tan[c + d*x]]) + 2*b^2*Tan[c + d*x])/(2*d)

________________________________________________________________________________________

fricas [A]  time = 0.52, size = 60, normalized size = 1.54 \[ \frac {{\left (a^{2} - b^{2}\right )} d x \cos \left (d x + c\right ) - 2 \, a b \cos \left (d x + c\right ) \log \left (-\cos \left (d x + c\right )\right ) + b^{2} \sin \left (d x + c\right )}{d \cos \left (d x + c\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

((a^2 - b^2)*d*x*cos(d*x + c) - 2*a*b*cos(d*x + c)*log(-cos(d*x + c)) + b^2*sin(d*x + c))/(d*cos(d*x + c))

________________________________________________________________________________________

giac [A]  time = 0.21, size = 44, normalized size = 1.13 \[ \frac {a b \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + b^{2} \tan \left (d x + c\right ) + {\left (a^{2} - b^{2}\right )} {\left (d x + c\right )}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^2,x, algorithm="giac")

[Out]

(a*b*log(tan(d*x + c)^2 + 1) + b^2*tan(d*x + c) + (a^2 - b^2)*(d*x + c))/d

________________________________________________________________________________________

maple [A]  time = 3.74, size = 57, normalized size = 1.46 \[ a^{2} x -b^{2} x +\frac {b^{2} \tan \left (d x +c \right )}{d}-\frac {2 a b \ln \left (\cos \left (d x +c \right )\right )}{d}+\frac {a^{2} c}{d}-\frac {c \,b^{2}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^2,x)

[Out]

a^2*x-b^2*x+b^2*tan(d*x+c)/d-2*a*b*ln(cos(d*x+c))/d+1/d*a^2*c-1/d*c*b^2

________________________________________________________________________________________

maxima [A]  time = 0.43, size = 49, normalized size = 1.26 \[ \frac {{\left (d x + c\right )} a^{2} - {\left (d x + c - \tan \left (d x + c\right )\right )} b^{2} - a b \log \left (-\sin \left (d x + c\right )^{2} + 1\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

((d*x + c)*a^2 - (d*x + c - tan(d*x + c))*b^2 - a*b*log(-sin(d*x + c)^2 + 1))/d

________________________________________________________________________________________

mupad [B]  time = 0.68, size = 118, normalized size = 3.03 \[ \frac {b^2\,\mathrm {tan}\left (c+d\,x\right )}{d}+\frac {2\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {2\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {2\,a\,b\,\ln \left (\frac {\cos \left (c+d\,x\right )}{\cos \left (c+d\,x\right )+1}\right )}{d}+\frac {2\,a\,b\,\ln \left (\frac {1}{{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a*cos(c + d*x) + b*sin(c + d*x))^2/cos(c + d*x)^2,x)

[Out]

(b^2*tan(c + d*x))/d + (2*a^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d - (2*b^2*atan(sin(c/2 + (d*x)/2)/
cos(c/2 + (d*x)/2)))/d - (2*a*b*log(cos(c + d*x)/(cos(c + d*x) + 1)))/d + (2*a*b*log(1/cos(c/2 + (d*x)/2)^2))/
d

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (a \cos {\left (c + d x \right )} + b \sin {\left (c + d x \right )}\right )^{2} \sec ^{2}{\left (c + d x \right )}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)**2*(a*cos(d*x+c)+b*sin(d*x+c))**2,x)

[Out]

Integral((a*cos(c + d*x) + b*sin(c + d*x))**2*sec(c + d*x)**2, x)

________________________________________________________________________________________